package com.ishansong.ticket.business.service;

import com.ishansong.ticket.exception.ServiceDaoException;
import com.ishansong.ticket.exception.ServiceException;
import com.ishansong.ticket.model.Ticket;
import com.ishansong.ticket.model.TicketQaGroup;
import com.ishansong.ticket.model.TicketUser;
import com.ishansong.ticket.vo.BindingUserVo;
import com.ishansong.ticket.vo.PageVo;
import com.ishansong.ticket.vo.TicketDataVo;
import com.ishansong.ticket.vo.TicketListVo;

import java.util.List;
import java.util.Map;

/**
 * Created by saiyin on 15/9/25.
 *
 */
public interface TicketBusinessService {
    /**
     * 创建工单
     * @param ticket   工单信息
     * @return long
     * @throws ServiceDaoException
     * @throws ServiceException
     */
    long save(Ticket ticket) throws ServiceDaoException, ServiceException;

    /**
     * 修改工单
     * @param ticket 工单信息
     * @return
     * @throws ServiceDaoException
     * @throws ServiceException
     */
    long update(Ticket ticket) throws ServiceDaoException, ServiceException;

    /**
     * 修改工单状态
     * @param id         工单id
     * @param status     状态
     * @param operatorId 操作人
     * @param remark     备注
     * @throws ServiceException
     */
    void updateTicketStatusById(long id, int status, String operatorId,String remark) throws ServiceDaoException, ServiceException;

    /**
     * 获取工单信息
     * @param id  工单id
     * @return TicketDataVo
     * @throws ServiceException
     */
    TicketDataVo queryTicketById(long id) throws ServiceDaoException, ServiceException;

    /**
     * 获取问题列表
     * @param pid 父id
     * @param type 0闪送 1客户
     * @return List<TicketQaGroup>
     * @throws ServiceDaoException
     * @throws ServiceException
     */
    List<TicketQaGroup> queryTicketQaGroupsByPid(Integer pid,Integer type) throws ServiceDaoException, ServiceException;

    /**
     * 根据订单号获取工单数量
     * @param orderNumber 订单号
     * @return int
     * @throws ServiceDaoException
     * @throws ServiceException
     */
    int queryTicketCountByOrderNumber(String orderNumber) throws ServiceDaoException, ServiceException;

    /**
     * 根据订单号获取工单
     * @param orderNumber 订单号
     * @return List<TicketListVo>
     * @throws ServiceDaoException
     * @throws ServiceException
     */
    List<TicketListVo> queryTicketByOrderNumber(String orderNumber) throws ServiceDaoException, ServiceException;

    /**
     * 创建工单用户
     * @param ticketUser 工单用户
     * @return
     * @throws ServiceDaoException
     * @throws ServiceException
     */
    Long saveTicketUser(TicketUser ticketUser) throws ServiceDaoException, ServiceException;

    /**
     * 获取工单分页
     * @param status     状态
     * @param start      开始
     * @param pageSize   每页显示数量
     * @return PageVo<TicketListVo>
     * @throws ServiceDaoException
     * @throws ServiceException
     */
    PageVo<TicketListVo> queryTicketByPage(Integer status,int start,int pageSize,String operatorId) throws ServiceDaoException, ServiceException;

    /**
     * 我的工单数据获取
     * @param status 工单状态
     * @return
     * @throws ServiceDaoException
     * @throws ServiceException
     */
    List<TicketListVo> queryMyTicketByStatus(Integer status,String operatorId) throws ServiceDaoException, ServiceException;

    String helloWord();

    /**
     * 手机号获取工单
     * @param mobile 电话
     * @return List<TicketListVo>
     * @throws ServiceDaoException
     * @throws ServiceException
     */
    List<TicketListVo> queryTicketByMobile(String mobile) throws ServiceDaoException, ServiceException;

    /**
     * 领单
     * @param ids 工单id
     * @throws ServiceDaoException
     * @throws ServiceException
     */
    void updateTicketStarus(Long[] ids,String operatorId) throws ServiceDaoException, ServiceException;

    /**
     * 删除工单
     * @param id 工单id
     * @param operatorId 操作人
     * @throws ServiceDaoException
     * @throws ServiceException
     */
    void deleteTicketById(long id,String operatorId) throws ServiceDaoException, ServiceException;

    /**
     * 获取绑定关系
     * @param loginName  登陆名称
     * @return BindingUserVo
     * @throws ServiceDaoException
     * @throws ServiceException
     */
    BindingUserVo queryBindingUserByLoginName(String loginName) throws ServiceDaoException, ServiceException;

    /**
     * 获取用户数据
     * @param mobile
     * @return
     * @throws ServiceDaoException
     * @throws ServiceException
     */
    TicketUser queryTicketUserByMobile(String mobile) throws ServiceDaoException, ServiceException;

    /**
     * 获取工单数量
     * @param operatorId 操作人
     * @return Map<Integer,Integer>
     * @throws ServiceDaoException
     * @throws ServiceException
     */
    Map<Integer,Integer> queryTicketCountByStatus(String operatorId) throws ServiceDaoException, ServiceException;

    /**
     * 获取我的工单数量
     * @param operatorId 操作人
     * @return Map<Integer,Integer>
     * @throws ServiceDaoException
     * @throws ServiceException
     */
    Map<Integer,Integer> queryTicketMyCountByStatus(String operatorId) throws ServiceDaoException, ServiceException;
}
